<link rel="stylesheet" href="<%= basePath %>/lib/sui.min.css">
<link rel="stylesheet" href="<%= basePath %>/lib/sui-append.min.css">
<link rel="stylesheet" href="<%= basePath %>/public/iconfont/iconfont.css">
<link rel="stylesheet" href="<%= basePath %>/public/css/style.css">
<link rel="stylesheet" href="<%= basePath %>/modules/teacher/css/style.css">

<script type="application/javascript" src="<%= basePath %>/lib/jquery.min.js"></script>
<script type="application/javascript" src="<%= basePath %>/lib/sui.min.js"></script>

<div class="body_scroll">
    <!--NO.9 教师 考勤补录 吴亚-->
    <div class="frame-content">
        <ul class="info_list">
            <li class="li_info">
                <span class="iconfont" style="color: #5396f1; float: left; margin-top: 3px">&#xe61f;</span>
                <form class="sui-form form-horizontal" style="float: left; margin: 3px 0 0 0">
                    <div class="control-group" style="margin: 0; font-size: 14px">
                        <span style="font-size: 14px"></span>&nbsp;日期：
                        <div class="input-control control-right">
                            <input type="text" data-toggle="datepicker" class="input-start-time date_input_top" style="width: 126px">
                            <i class="sui-icon iconfont table_header_date_icon">&#xe605;</i>
                        </div>
                    </div>
                </form>
                <span style="font-size: 14px">&nbsp;&nbsp;状态：</span>
                        <span class="sui-dropdown dropdown-bordered table_header select">
                            <span class="dropdown-inner">
                            <a role="button" data-toggle="dropdown" class="dropdown-toggle" id="status_select">
                                <input type="hidden" value="0" id="teacher_search_status"><i class="caret"></i><span>全部</span>
                            </a>
                            <ul role="menu" aria-labelledby="status_drop" class="menu-status sui-dropdown-menu">
                                <li role="presentation" class="active"><a role="menuitem" tabindex="-1" value="0">全部</a></li>
                                <li role="presentation"><a role="menuitem" tabindex="-1" value="1">出勤</a></li>
                                <li role="presentation"><a role="menuitem" tabindex="-1" value="-2">迟到</a></li>
                                <li role="presentation"><a role="menuitem" tabindex="-1" value="-3">早退</a></li>
                                <li role="presentation"><a role="menuitem" tabindex="-1" value="3">请假</a></li>
                                <li role="presentation"><a role="menuitem" tabindex="-1" value="-1">旷课</a></li>
                            </ul>
                            </span>
                        </span>

                <!--选择班级补考勤-->
                <span style="font-size: 14px; margin-left: 18px">&nbsp;&nbsp;班级：</span>
                         <span class="sui-dropdown dropdown-bordered table_header select">
                            <span class="dropdown-inner">
                            <a role="button" data-toggle="dropdown" class="dropdown-toggle" id="status_select">
                                <input type="hidden" value="0" id="teacher_search_class"><i class="caret"></i><span>全部</span>
                            </a>
                            <ul role="menu" aria-labelledby="status_drop" class="menu-class sui-dropdown-menu">
                                <li role="presentation" class="active"><a role="menuitem" tabindex="-1" value="0">全部</a></li>
                                <% teacher.managedClasses.forEach(function(natureClass) { %>
                                <li role="presentation"><a role="menuitem" tabindex="-1" value="<%=natureClass.id%>"><%=natureClass.name%></a></li>

                                <% }); %>
                            </ul>
                            </span>
                        </span>
                <div style="margin-top:10px;">
                    <span style="margin-left: 20px">学号：</span>
                    <input type="text" class="input-sid input-fat" style="height: 18px;width: 132px;margin-right: 6px">
                    <span>姓名：</span>
                    <input type="text" class="input-name input-fat" style="height: 18px;width: 95px;margin-right:25px;">
                    <a class="btn-search sui-btn btn-primary recording_search_btn" style="float: none;">查询</a>
                </div>
                <div style="clear:both;"></div>
            </li>
            <li class="li_footer">
                <div class="teacher_search_table_div teacher_search_td_default" style="margin-bottom: 120px">
                    <table class="sui-table table-zebra table-bordered attend_table">
                        <thead>
                        <tr>
                            <th>学号</th>
                            <th>姓名</th>
                            <th colspan="2">上午</th>
                            <th colspan="2">下午</th>
                            <th colspan="2">晚上</th>
                        </tr>
                        </thead>
                        <tbody>
                        <% attendances.forEach(function(attendance) { %>
                        <tr data-id="<%=attendance.id%>">
                            <td><%=attendance.student.sid%></td>
                            <td><%=attendance.student.name%></td>
                            <% attendance.values.forEach(function(value) { %>
                            <td class="attend_search_detail" data-id="<%=value.id%>" data-type="enter">
                                    <span class="sui-dropdown dropdown-bordered select recording_select_div">
                                        <span class="dropdown-inner unClick" style="border: none; width: 100%">
                                            <a role="button" data-toggle="dropdown" class="dropdown-toggle unClick" style="min-width: 0">
                                                <input name="infoemation" type="hidden"><i data-status="<%=AttendanceDescriptions.get(value.enterStatus)%>" class="caret table_select_hide table_select"></i>
                                                <span data-id="status_text_enter<%=value.id%>">
                                                    <%=AttendanceDescriptions.get(value.enterStatus)%>
                                                </span>
                                            </a>
                                            <ul role="menu" aria-labelledby="drop4" data-status="<%=AttendanceDescriptions.get(value.enterStatus)%>" class="sui-dropdown-menu table_select_hide table_select" style="margin-left: -13px">
                                                <li role="presentation" value="1" onclick="editStatusClicked(event)"><a role="menuitem">出勤</a></li>
                                                <li role="presentation" value="-2" onclick="editStatusClicked(event)"><a role="menuitem">迟到</a></li>
                                                <li role="presentation" value="-1" onclick="editStatusClicked(event)"><a role="menuitem">旷课</a></li>
                                                <li role="presentation" value="3" onclick="editStatusClicked(event)"><a role="menuitem">请假</a></li>
                                            </ul>
                                        </span>
                                    </span>
                            </td>
                            <td class="attend_search_detail" data-id="<%=value.id%>" data-type="exit">
                                    <span class="sui-dropdown dropdown-bordered select recording_select_div">
                                        <span class="dropdown-inner" style="border: none; width: 100%">
                                            <a role="button" data-toggle="dropdown" class="dropdown-toggle" style="min-width: 0">
                                                <input name="infoemation" type="hidden"><i data-status="<%=AttendanceDescriptions.get(value.exitStatus)%>" class="caret table_select_hide table_select"></i>
                                                <span data-id="status_text_exit<%=value.id%>">
                                                    <%=AttendanceDescriptions.get(value.exitStatus)%>
                                                </span>
                                            </a>
                                            <ul role="menu" aria-labelledby="drop4" data-status="<%=AttendanceDescriptions.get(value.exitStatus)%>" class="sui-dropdown-menu table_select_hide table_select" style="margin-left: -13px">
                                                <li role="presentation" value="1" onclick="editStatusClicked(event)"><a role="menuitem">出勤</a></li>
                                                <li role="presentation" value="-3" onclick="editStatusClicked(event)"><a role="menuitem">早退</a></li>
                                                <li role="presentation" value="-1" onclick="editStatusClicked(event)"><a role="menuitem">旷课</a></li>
                                                <li role="presentation" value="3" onclick="editStatusClicked(event)"><a role="menuitem">请假</a></li>
                                            </ul>
                                        </span>
                                    </span>
                            </td>
                            <% }); %>
                        </tr>
                        <% }); %>
                        </tbody>
                    </table>
                </div>
            </li>
        </ul>
    </div>
</div>
<div id="edit" style="max-width: 1000px; min-width: 800px; position: absolute; height: 60px; background-color: rgba(255, 255, 255, 0.8); z-index: 99; bottom: 0">
    <div style="width: 100%;" id="edit_before">
        <a class="sui-btn btn-primary recording_edit_btn" style="display: block; margin-left: auto; margin-right: auto" onclick="editButtonClicked(event)">编辑</a>
    </div>
    <div style="width: 100%;" id="edit_after" hidden>
        <a class="sui-btn btn-primary recording_edit_btn" style="margin-left: calc(50% - 101px)" onclick="cancelButtonClicked(event)">取消</a>
        <a class="sui-btn btn-primary recording_edit_btn" onclick="saveButtonClicked(event)">保存</a>
    </div>
</div>

<script>
    Attendances = JSON.parse('<%=JSON.stringify(attendanceObjects);%>'.replace(new RegExp(/&#34;/g), '"'));
    console.log(Attendances);
</script>
<script type="application/javascript" src="<%= basePath%>/public/js/util.js"></script>
<script type="application/javascript" src="<%= basePath%>/modules/teacher/js/today.js"></script>
<script type="application/javascript" src="<%= basePath%>/modules/teacher/js/add.js"></script>

<script>
    $(document).ready(function () {
        var dateInput = $('.input-start-time.date_input_top');
        dateInput.change(function () {
            if (!dateInput.val()) {
                dateInput.datepicker('update', new Date());
            }
        });
    });
</script>